<template>
  <div>
    <i class="el-icon-search text-xl text-blue pointer" @click="getInfo"></i>

    <el-dialog
      title="计划数据"
      :visible.sync="dialogTableVisible"
      :before-close="closeDialog"
    >
      <el-table :data="tableData" size="mini">
        <el-table-column property="objectiveId" label="目标描述">
          <template slot-scope="scope">
            <div>
              {{amoebaMap[scope.row["objectiveId"]]}}
            </div>
          </template>
        </el-table-column>
        <el-table-column property="money" label="目标值"></el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>

<script>
import { ajax } from "@/store/yg/common/utils";
export default {
  props: ["data"],
  data() {
    return {
      dialogTableVisible: false,
      loading: false,
      tableData: [],
      amoebaMap: [],
    };
  },
  mounted() {
    this.initSource();
  },
  methods: {
    initSource(){
      this.amoebaMap = this.$store.state.main.entry.sources["amoebaObjectiveSource"];
      console.log("amoebaMap"+this.amoebaMap);
    },
    async getInfo() {
      this.dialogTableVisible = true;
      this.loading = true;
      const data = await ajax("subjectAllList", {pid: this.data.id });
      this.tableData = data;
      this.loading = false;
    },
    closeDialog() {
      this.dialogTableVisible = false;
      this.tableData = [];
    }
  }
};
</script>

<style></style>
